package com.winsomely.leecode;

/**
 * 数字 1 的个数
 * 
 * @author liujiawei
 *
 */
public class MissingNumber {

	/**
	 * @param nums
	 * @return
	 */
	public int missingNumber(int[] nums) {
		int n = nums.length;
		int a = 0, b = n;
		for (int i = 0; i < n; i++) {
			a += nums[i];
			b += i;
		}
		return b - a;
	}

	public static void main(String[] args) {
		MissingNumber t = new MissingNumber();
		int[] nums = { 0 };
		System.out.println(t.missingNumber(nums));
	}

}
